<template>
  <!-- 设置挂载点 -->
  <div id="main"></div>
</template>

<script>
export default {
  name: "Edate",
  mounted() {
    this.add();
  },
  methods: {
    add() {
      var chartDom = document.getElementById("main");
      var myChart = this.$echarts.init(chartDom);
      var option;

      option = {
        tooltip: {
          trigger: "item",
        },
        legend: {
          top: "5%",
          left: "center",
        },
        series: [
          {
            name: "商户数据可视化",
            type: "pie",
            radius: ["40%", "70%"],
            avoidLabelOverlap: false,
            itemStyle: {
              borderRadius: 10,
              borderColor: "#fff",
              borderWidth: 2,
            },
            label: {
              show: false,
              position: "center",
            },
            emphasis: {
              label: {
                show: true,
                fontSize: "40",
                fontWeight: "bold",
              },
            },
            labelLine: {
              show: false,
            },
            data: [
              { value: 1048, name: "营业中" },
              { value: 735, name: "新注册" },
              { value: 580, name: "城市" },
              { value: 484, name: "已注销" },
              { value: 300, name: "乡镇" },
            ],
          },
        ],
      };

      option && myChart.setOption(option);
    },
  },
};
</script>

<style lang='scss' scoped>
div {
  height: 500px;
  height: 500px;
}
</style>
